<!--
  @Description:需求详情
  @author Wangshu
  @date 2019/8/21
-->

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="__PUBLIC__/css/common/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/css/demandDetail.css">
    <link rel="stylesheet" href="__PUBLIC__/css/header.css">
    <link rel="stylesheet" href="__PUBLIC__/css/common/common.css">
    <title>山东科技大学技术转移公共服务平台-需求详情</title>

</head>
<body>
<head>
    <div class="top-title">
        <div>
            <span>欢迎登陆山东科技大学技术转移公共服务平台！</span>
            <if condition="$uid eq null">
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('login/index')}">登录</a>
                    <span class="spece">|</span>
                    <a href="{:url('login/signup')}">注册</a>
                </div>
                <else/>
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('me/me')}">欢迎你！</a>
                    <a href="{:url('me/me')}">{$user.real_name}</a>
                </div>
            </if>
        </div>
    </div>
    <div class="logo-box">
        <div class="logo-wrap">
            <div>
                <img src="__PUBLIC__/asset/fodder/logo.png" alt="">
            </div>
            <div>
                <div class="search">
                    <div class="dropdown">
                        <div class="btn select-default dropdown-toggle" type="button" id="dropdownMenu1"
                             data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                            请选择学院
                            <span><img style="width: 20px;" src="__PUBLIC__/asset/icon/dropdown.png" alt=""></span>
                        </div>
                        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                            <foreach name="allColleges" item="vo">
                                <li><a onclick="shows1($(this).text(),{$vo.id})">{$vo.college_name}</a></li>
                            </foreach>
                        </ul>
                    </div>
                    <div class="search-block">
                        <input type="text" name="keyword" id="keyword">
                    </div>
                    <div class="submit" id="submit">
                        <img src="__PUBLIC__/asset/icon/search.png" alt="">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="nav-box">
        <div class="nav-list">
            <ul>
                <li><a href="{:url('/index/index')}">首页</a></li>
                <li><a href="{:url('news/index')}">新闻</a></li>
                <li><a href="{:url('people/index')}">人才库</a></li>
                <li><a href="{:url('fruit/index')}">成果库</a></li>
                <if condition="$user_type eq 0">
                    <li class="active"><a href="{:url('requirement/index')}">需求库</a></li>
                </if>
                <li><a href="{:url('me/callme')}">联系我们</a></li>
            </ul>
        </div>
    </div>
</head>
<main>
    <div class="content-wrap">
        <div class="site">
            <span><a href="./home.html">首页</a> <img src="__PUBLIC__/asset/icon/right.png" alt=""></span>
            <span><a href="">需求库</a>  <img src="__PUBLIC__/asset/icon/right.png" alt=""></span>
            <span><a class="active" href="">正文</a> </span>
        </div>


        <div class="art-tit">
            <div class="title">
                <h1>{$requirement.title}</h1>
                <if condition="$uid neq null">
                    <div>
                        <if condition="$collection eq null">
                            <img id="like_img" src="__PUBLIC__/asset/icon/like.png" alt="">
                            <span id="like">点击收藏</span>
                            <else/>
                            <img id="like_img" src="__PUBLIC__/asset/icon/like2.png" alt="">
                            <span id="like">点击取消收藏</span>
                        </if>
                        <input type="hidden" id="collection_id" value="{$collection.id}">

                    </div>
                </if>
            </div>
            <div>
                <span>发布者：<if condition="$requirement.issuer_type eq 2">后台管理员<else/>{$issuer.real_name}</if></span><span>{$requirement.create_time|date="Y-m-d"}</span>
            </div>
            <div class="line"></div>
        </div>
        <div class="content">
            <!--内容部分-->
            <div class="detail">
                {$requirement.content|raw}
            </div>

            <if condition="$getList neq null">
                <div>
                    <foreach name="getList" item="vo">
                     <li>
                         <label class="layui-form-label">获取人：<span class="form-required">{$vo.user.real_name|default='未设置'}</span></label>
                         <label class="layui-form-label">工号：<span class="form-required">{$vo.user.teacher_no|default='非老师'}</span></label>
                         <label class="layui-form-label">联系方式：<span
                                 class="form-required">{$vo.phone|default='未设置'}</span></label>
                         <label class="layui-form-label">操作时间：<span
                                 class="form-required">{$vo.time|date="Y-m-d H:i:s"|default='未设置'}</span></label>
                     </li>
                    </foreach>
                </div>
            </if>

            <div class="call">
                <div id="callMe">我要联系</div>
            </div>
        </div>
    </div>
</main>
<footer>
    <div class="foot-line">
        <span>青岛校区地址：山东省青岛市黄岛区前湾港路579号</span>
        <span>邮政编码：266590</span>
        <span>联系电话：0532-80698028\80698027\80678029</span>
        <span>传真：0532-80698029</span>
    </div>
    <div class="foot-line">
        <span>泰安校区地址：山东省泰安市岱宗大街223号</span>
        <span>邮政编码：271019</span>
        <span>联系电话：0538-3076489</span>
        <span>传真：0538-3076489</span>
    </div>
    <div class="last-line">
        Copyright©2019 　山东科技大学 　鲁ICP备09051012号
        <span style="line-height: 26px ; margin-left: 20px;"><img
                style="width: 44px;height: 17px; margin-right: 10px;vertical-align: middle"
                src="__PUBLIC__/asset/fodder/todo_white.png" alt=""><span
                style="vertical-align: middle">投道科技提供技术支持</span></span>
    </div>
    <div></div>
</footer>

<div class="mobile-box">
    <div class="pop">
        <div class="close"><img src="__PUBLIC__/asset/icon/close.png" alt=""></div>
        <div class="logo"><img src="__PUBLIC__/asset/fodder/logo.png" alt=""></div>
        <p>我要联系</p>
        <div class="number-box">
            <div class="mobile">
                <input type="text" placeholder="请输入手机号" id="phone">
            </div>
            <div class="code">
                <div>
                    <input type="text" placeholder="请输入验证码" id="code">
                </div>
                <div class="code-btn">获取验证码</div>
            </div>
            <div class="submit">
                <div onclick="$('.mobile-box').css('display', 'none')">取消</div>
                <div id="getInfo">确定</div>
            </div>
        </div>
    </div>
</div>

<div class="info-box">
    <div class="pop">
        <div class="close"><img src="__PUBLIC__/asset/icon/close.png" alt=""></div>
        <div class="logo"><img src="__PUBLIC__/asset/fodder/logo.png" alt=""></div>
        <p>我要联系</p>
        <div class="number-box contain-box">
            <div class="contact-info">
                <div><span>需求:</span><span>{$requirement.title}</span></div>
                <div><span>发布者:</span><span>{$issuer.real_name}</span></div>
                <div><span>联系方式:</span><span>{$requirement.phone}</span></div>
            </div>
            <div class="submit">
                <div onclick="$('.info-box').css('display', 'none')">确定</div>
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/public/jquery-1.11.3.min.js"></script>
<script src="__PUBLIC__/js/public/swiper.min.js"></script>
<script src="__PUBLIC__/js/public/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/layer/layer/layer.js"></script>
<script>
    $(function () {
        $('#callMe').on('click', function () {
            $('.mobile-box').css('display', 'block')

        })
        $('.mobile-box .close').click(function () {
            $('.mobile-box').css('display', 'none')
        })

        $('.info-box .close').click(function () {
            $('.info-box').css('display', 'none')
        })
    });
    $('.dropdown-toggle').dropdown()

    var selectCollege = null;

    function shows1(a, id) {
        selectCollege = {id, college: a};
        $("#dropdownMenu1").text(a);
    }


    $("#submit").on('click', function () {
        var name = $("#keyword").val();
        if (!selectCollege) {
            window.open("{:url('requirement/index')}?keyword=" + name)
        } else {
            window.open("{:url('requirement/index')}?college=" + selectCollege.id + "&keyword=" + name)
        }
    })

    $("#like").click(function () {
        let collection_id = $("#collection_id").val();
        if (collection_id) {
            $.post('uncollect', {type: 2, cid: `{$requirement.id}`}, function (res) {
                if (res.code == 0) {
                    return layer.msg(res.msg)
                } else {
                    $("#like").text("点击收藏")
                    $("#collection_id").val('')
                    $("#like_img").attr('src', "__PUBLIC__/asset/icon/like.png")
                }
            })
        } else {
            $.post('collect', {type: 2, cid: `{$requirement.id}`}, function (res) {
                if (res.code == 0) {
                    return layer.msg(res.msg)
                } else {
                    $("#like").text("点击取消收藏")
                    $("#collection_id").val(res.id)
                    $("#like_img").attr('src', "__PUBLIC__/asset/icon/like2.png")
                }
            })
        }
    })

    $("#getInfo").click(function () {
        const phone = $("#phone").val();
        const code = $("#code").val();
        console.log(phone)
        $.post('contact', {id: `{$requirement.id}`, phone, code}, function (res) {
            console.log(res)
            if (res.code == 0) {
                return layer.msg(res.msg)
            } else {
                $('.info-box').css('display', 'block')
                $('.mobile-box').css('display', 'none')
            }
        })
    })

    $(".code-btn").click(function () {
        const phone = $("#phone").val();
        $.post('getCode', {phone: phone}, function (res) {
            console.log(res)
            if (res.code == 0) {
                return layer.msg(res.msg);
            } else {
                return layer.msg(res.msg);
            }
        })
    })
</script>
</body>
</html>
